//package com.warren.util;
//
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.context.annotation.Bean;
//import org.springframework.mail.javamail.JavaMailSenderImpl;
//import org.springframework.mail.javamail.MimeMessageHelper;
//
//import javax.mail.MessagingException;
//import javax.mail.internet.MimeMessage;
//import java.io.File;
//import java.util.HashMap;
//
///**
// * @version V1.0
// * @Description:
// * @author: warren
// * @date: 2022/4/1$ 16:05$
// */
//@Slf4j
//public class MaiUtil {
//    @Autowired
//    JavaMailSenderImpl mailSender;
//
//    public void sendMime(String subject, String text, String to, String from, HashMap<String, String>attach) {
//        MimeMessage mimeMessage = mailSender.createMimeMessage();
//        MimeMessageHelper helper = null;
//        try {
//            helper = new MimeMessageHelper(mimeMessage, true);
//            helper.setSubject(subject);
//            helper.setText(text);
//
//
//            //附件
//            helper.addAttachment(attach.get("attach"), new File(attach.get("attachFile")));
//            helper.setTo(to);
//            helper.setFrom(from);
//
//            mailSender.send(mimeMessage);
//        } catch (MessagingException e) {
//            e.printStackTrace();
//            log.error("发送失败", e.getMessage());
//        }
//    }
//}
